home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / thrust-s.53 / thrust-s / thrust / Makefile < prev    next >
Makefile  |  1995-11-05  |  5KB  |  189 lines

  1.  
  2. # Written by Peter Ekberg, peda@lysator.liu.se
  3.  
  4. SHELL        = /bin/sh
  5. CC           = gcc
  6. DD           = dd
  7.  
  8. BINDIR       = /usr/local/games
  9. STATEDIR     = /var/games
  10.  
  11. DEFINES      = $(strip \
  12.                  -DHIGHSCOREFILE=\"$(STATEDIR)/$(PRG).highscore\" \
  13.                  -DVERSION=\"$(VERSION)\" )
  14. OPTIMIZE     = -fomit-frame-pointer -O2 -s -m486
  15. COMPILE      = -Wall
  16. ALL_CFLAGS   = $(DEFINES) $(OPTIMIZE) $(COMPILE) $(CFLAGS)
  17. LDFLAGS      = -N
  18.  
  19. PRG          = thrust
  20. VERSION      = 0.53
  21. SOURCE       = src
  22. DATASRC      = datasrc
  23.  
  24. LIBS         = -lvgagl -lvga -lm
  25.  
  26. HELPPRG      = $(addprefix $(DATASRC)/, bin2c txt2c reverse)
  27.  
  28. BIN8         = $(addprefix $(DATASRC)/, \
  29.                  blocks0.bin blocks1.bin blocks2.bin blocks3.bin \
  30.                  blocks4.bin blocks5.bin blocks6.bin blocks7.bin \
  31.                  blocks8.bin blocks9.bin blocksa.bin blocksb.bin \
  32.                  blocksc.bin blocksd.bin blockse.bin blocksf.bin )
  33.  
  34. SOURCEOBJS   = $(addprefix $(SOURCE)/, \
  35.                  thrust.o graphics.o level.o init.o things.o sinus.o \
  36.                  fast_gr.o font5x5.o intro.o highscore.o )
  37. DATAOBJS     = $(addprefix $(DATASRC)/, \
  38.                  font.o blocks.o ship.o shield.o colors.o bullets.o \
  39.                  level1.o level2.o level3.o level4.o demomoves.o )
  40. OBJS         = $(SOURCEOBJS) $(DATAOBJS)
  41.  
  42. TARFILE      = $(PRG)-src-$(VERSION).tar.gz
  43. BINTARFILE   = $(PRG)-bin-$(VERSION).tar.gz
  44. DISTFILES    = COPYING README INSTALL TODO CHANGES \
  45.                Makefile* $(PRG)-$(VERSION).lsm
  46. DISTDIRS     = $(SOURCE) $(DATASRC)
  47.  
  48.  
  49. #######################
  50. #
  51. # Targets.
  52. #
  53. #######################
  54.  
  55. all: $(PRG)
  56.  
  57. install: $(PRG)
  58.     cp $(PRG) $(BINDIR)/$(PRG)
  59.     chown root.root $(BINDIR)/$(PRG)
  60.     chmod a+rs $(BINDIR)/$(PRG)
  61.  
  62. uninstall:
  63.     rm $(BINDIR)/$(PRG)
  64.     rm $(STATEDIR)/$(PRG).highscore
  65.  
  66. clean:
  67.     rm -rf $(strip *~ core $(PRG) $(OBJS) $(HELPPRG) \
  68.                        $(DATASRC)/blocks*.bin $(TARFILE) )
  69.  
  70. distclean: clean
  71.     rm -f $(SOURCE)/TAGS
  72.     rm -f $(BINTARFILE)
  73.  
  74. mostlyclean:
  75.     rm -rf *~ core $(PRG) $(SOURCEOBJS)
  76.  
  77. realclean: distclean
  78.  
  79. TAGS:
  80.     etags $(SOURCE)/*.c -o $(SOURCE)/TAGS
  81.  
  82. info:
  83.     @echo No documentation available.
  84.  
  85. dvi:
  86.     @echo No documentation available.
  87.  
  88. dist: distclean
  89.     mkdir $(PRG)
  90.     mkdir $(PRG)/$(SOURCE)
  91.     mkdir $(PRG)/$(DATASRC)
  92.     cp -dpf $(DISTFILES) $(PRG)
  93.     for i in $(DISTDIRS) ; do cp -dpf $$i/* $(PRG)/$$i ; done
  94.     tar -czf $(TARFILE) $(PRG)/*
  95.     rm -rf $(PRG)
  96.  
  97. bindist: $(PRG)
  98.     mv $(PRG) $(PRG).binary
  99.     mkdir $(PRG)
  100.     cp -dpf $(DISTFILES) $(PRG)
  101.     rm -f $(PRG)/Makefile
  102.     mv $(PRG)/Makefile.binary $(PRG)/Makefile
  103.     mv $(PRG).binary $(PRG)/$(PRG)
  104.     tar -czf $(BINTARFILE) $(PRG)/*
  105.     mv $(PRG)/$(PRG) $(PRG).binary
  106.     rm -rf $(PRG)
  107.     mv $(PRG).binary $(PRG)
  108.  
  109. #######################
  110. #
  111. # Implicit rules.
  112. #
  113. #######################
  114.  
  115. # Compile C files to object files.
  116. %.o: %.c
  117.     $(CC) $(ALL_CFLAGS) -c -o $(addprefix $(dir $<), $(notdir $@)) $<
  118. # Complie assembler files to object files. (Not used. Does it work?)
  119. %.s: %.c
  120.     $(CC) $(ALL_CFLAGS) -S -o $(addprefix $(dir $<), $(notdir $@)) $<
  121.  
  122.  
  123. # Extract palette information.
  124. %.bin: %.pal
  125.     $(DD) of=$@ if=$< bs=1 skip=790
  126. # Extract picture information.
  127. %.rbin: %.bmp
  128.     $(DD) of=$@ if=$< bs=1 skip=1078
  129.  
  130.  
  131. # The bmp format stores rows backwards (last row first).
  132. # These rules are used to "reverse" the order in which the rows are stored.
  133. # There is one rule for each of the three used widths of the line.
  134. %.bin: %.4.rbin $(DATASRC)/reverse
  135.     $(DATASRC)/reverse  4 < $< > $@
  136. %.bin: %.8.rbin $(DATASRC)/reverse
  137.     $(DATASRC)/reverse  8 < $< > $@
  138. %.bin: %.16.rbin $(DATASRC)/reverse
  139.     $(DATASRC)/reverse 16 < $< > $@
  140.  
  141.  
  142. # Make a C file out of a text file. The info is stored in an array of strings.
  143. # One line in the original text file will be stored in one cell of the array.
  144. %.c: %.def $(DATASRC)/txt2c
  145.     $(DATASRC)/txt2c $(notdir $(basename $<)) < $< > $@
  146. # Make a C file out of a binary file. The info is stored in a byte array.
  147. %.c: %.bin $(DATASRC)/bin2c
  148.     $(DATASRC)/bin2c bin_$(notdir $(basename $<)) < $< > $@
  149.  
  150.  
  151. #######################
  152. #
  153. # Secondary targets.
  154. #
  155. #######################
  156.  
  157. $(PRG): $(OBJS)
  158.     $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $(PRG) $(OBJS) $(LIBS)
  159.  
  160.  
  161. $(DATASRC)/blocks.bin: $(BIN8)
  162.     cat $^ > $@
  163.  
  164. $(DATASRC)/reverse: $(DATASRC)/reverse.c
  165.     $(CC) $(ALL_CFLAGS) $< -o $@
  166.  
  167. $(DATASRC)/bin2c:  $(DATASRC)/bin2c.c
  168.     $(CC) $(ALL_CFLAGS) $< -o $@
  169.  
  170. $(DATASRC)/txt2c:  $(DATASRC)/txt2c.c
  171.     $(CC) $(ALL_CFLAGS) $< -o $@
  172.  
  173.  
  174. #######################
  175. #
  176. # Dependencies.
  177. #
  178. #######################
  179.  
  180. $(SOURCE)/thrust.o:    $(SOURCE)/thrust.c    $(SOURCE)/thrust.h
  181. $(SOURCE)/graphics.o:  $(SOURCE)/graphics.c  $(SOURCE)/thrust.h
  182. $(SOURCE)/level.o:     $(SOURCE)/level.c     $(SOURCE)/thrust.h
  183. $(SOURCE)/init.o:      $(SOURCE)/init.c      $(SOURCE)/thrust.h
  184. $(SOURCE)/things.o:    $(SOURCE)/things.c    $(SOURCE)/thrust.h
  185. $(SOURCE)/sinus.o:     $(SOURCE)/sinus.c     $(SOURCE)/thrust.h
  186. $(SOURCE)/fast_gr.o:   $(SOURCE)/fast_gr.c   $(SOURCE)/thrust.h
  187. $(SOURCE)/font5x5.o:   $(SOURCE)/font5x5.c
  188. $(SOURCE)/highscore.o: $(SOURCE)/highscore.c $(SOURCE)/thrust.h
  189.